docs: add missing imports in Box and Cohere reranker retriever examples - #5794
Open
SpiliosDmk (SpiliosDimakopoulos) wants to merge 1 commit into
Open
Conversation
Two retriever integration examples call classes that are never imported in the snippet, so copying them as-is raises NameError. - retrievers/box.mdx: the LangGraph agent example calls ChatOpenAI(...) without importing it. Added 'from langchain_openai import ChatOpenAI'. - retrievers/cohere-reranker.mdx: the QA pipeline example builds a chain using RunnablePassthrough() and StrOutputParser() without importing either. Added 'from langchain_core.output_parsers import StrOutputParser' and 'from langchain_core.runnables import RunnablePassthrough'. Same class of fix as PR langchain-ai#1619 (add missing import).
Contributor
|
Thanks for opening a docs PR, SpiliosDmk (@SpiliosDimakopoulos)! When it's ready for review, please add the relevant reviewers:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two retriever integration examples call classes that are never
imported in the snippet, so copying them as-is raises NameError.
src/oss/python/integrations/retrievers/box.mdx
The LangGraph agent example calls
ChatOpenAI(...)withoutimporting it. Added:
from langchain_openai import ChatOpenAIsrc/oss/python/integrations/retrievers/cohere-reranker.mdx
The QA pipeline example builds a chain with
RunnablePassthrough()and
StrOutputParser(), neither of which is imported. Added:from langchain_core.output_parsers import StrOutputParserfrom langchain_core.runnables import RunnablePassthroughWhy
Both symbols are used but never defined/imported anywhere else on
the page, so running the snippet as written fails immediately.
Same bug class as #1619 ("add missing import").
Type of change
4-line, docs-only change, no functional impact outside the code samples.